function [] = PostProcess(egn17,simout_S,simout_z,simtime,track)
%PostProcess function for the MBS, all kinematic calculations and such should happen here
%% Chassis Plots
Plots(simout_S,simout_z,simtime,track)
%% Center of Roll
R_f=Rollzentrum(egn17.HPs.f_fl,egn17.HPs.d_fl,egn17.HPs.e_fl,egn17.HPs.a_fl,egn17.HPs.b_fl,egn17.HPs.c_fl,...
                egn17.HPs.f_fr,egn17.HPs.d_fr,egn17.HPs.e_fr,egn17.HPs.a_fr,egn17.HPs.b_fr,egn17.HPs.c_fr,...
                egn17.HPs.w_fl,egn17.HPs.w_fr,...
                simout_S.S_UCAs.S_UCAfl.S_C_UCA.data,...
                simout_S.S_UCAs.S_UCAfr.S_C_UCA.data,...
                simout_S.S_LCAs.S_C_LCAs.S_C_LCAfl.data,...
                simout_S.S_LCAs.S_C_LCAs.S_C_LCAfr.data,...
                simout_S.S_Chassis.S_0_C.data);
        
R_r=Rollzentrum(egn17.HPs.f_rl,egn17.HPs.d_rl,egn17.HPs.e_rl,egn17.HPs.a_rl,egn17.HPs.b_rl,egn17.HPs.c_rl,...
                egn17.HPs.f_rr,egn17.HPs.d_rr,egn17.HPs.e_rr,egn17.HPs.a_rr,egn17.HPs.b_rr,egn17.HPs.c_rr,...
                egn17.HPs.w_rl,egn17.HPs.w_rr,...
                simout_S.S_UCAs.S_UCArl.S_C_UCA.data,...
                simout_S.S_UCAs.S_UCArr.S_C_UCA.data,...
                simout_S.S_LCAs.S_C_LCAs.S_C_LCArl.data,...
                simout_S.S_LCAs.S_C_LCAs.S_C_LCArr.data,...
                simout_S.S_Chassis.S_0_C.data);
x=linspace(0,simtime,length(R_f));
figure(3)
plot(x,R_f(3,:))
hold on
plot(x,R_r(3,:))
legend('CoR front','CoR rear');
hold off
%% Anti-Dive Anti-Squat
[AD_f,AD_r,AS_f,AS_r]=AD_AS(egn17.HPs.f_fl,egn17.HPs.d_fl,egn17.HPs.e_fl,egn17.HPs.a_fl,egn17.HPs.b_fl,egn17.HPs.c_fl,...
                            egn17.HPs.f_rl,egn17.HPs.d_rl,egn17.HPs.e_rl,egn17.HPs.a_rl,egn17.HPs.b_rl,egn17.HPs.c_rl,...
                            egn17.HPs.w_fl,egn17.HPs.w_fr,...
                            0.250,0.3,0.7,...
                            simout_S.S_UCAs.S_UCAfl.S_C_UCA.data,...
                            simout_S.S_LCAs.S_C_LCAs.S_C_LCAfl.data,...
                            simout_S.S_UCAs.S_UCArl.S_C_UCA.data,...
                            simout_S.S_LCAs.S_C_LCAs.S_C_LCArl.data);
figure(4)
plot(x,AD_f)
hold on
plot(x,AS_r)
plot(x,AS_f)
plot(x,AD_r)
legend('Anti-Dive front','Anti-Squat rear','Anti-Squat front','Anti-Dive rear');

hold off
% VeloctiyProfilMapSimulation(simout_z.x_C.data(:,:,:),simout_z.y_C.data(:,:,:),simout_z.dx_C_dt.data(:,:,:),5,70);
%% Plot position
movegui(1,'northwest');
movegui(2,'north');
movegui(3,'northeast');
movegui(4,'southwest');
end

